﻿//*****************************************************************************
//** Project:PatternWell.PAC
//** Copyright 2011 PatternWell LLC
//** Revision History:
//** Version 1.0 - Initial Release
//*****************************************************************************
using System.Windows;

namespace PatternWell.PAC
{
    /// <summary>
    /// Interface that exposes the actions that a pac can access to attach and detach a view.
    /// </summary>
    /// <typeparam name="TViewContract">The target view contract type for the view to be controlled.</typeparam>
    public interface IControlledView<TViewContract> where TViewContract:class,IViewContract
    {
        /// <summary>
        /// Helper method that will assign a view to be managed by the controller. 
        /// </summary>
        /// <remarks>
        /// You need to make sure the view is already been created before assigning it to the controller.
        /// </remarks>
        /// <param name="view">The instance of the view cast to the supported view resource interface by this controller.</param>
        void AttachView(TViewContract view);

        /// <summary>
        /// Helper method that will tell the controller to drop all references to the view, and to notify the view to release viewmodel resources.
        /// </summary>
        /// <returns>Returns the reference to the view that has been detached.</returns>
        TViewContract DetachView();

        /// <summary>
        /// The view that is managed by the hosting PAC.
        /// </summary>
        FrameworkElement ManagedView { get; }
    }
}
